﻿using System;
using System.Collections.Generic;
using System.Text;
using SZSLSystem.Common;
using SZSLSystem.Model;

namespace SZSLSystem.DAL
{
    /// <summary>
    /// 数据访问层：系统配置
    /// </summary>
    public class WebSet
    {
        private static object lockHelper = new object();

        /// <summary>
        ///  读取配置文件
        /// </summary>
        /// <param name="configFilePath"></param>
        /// <returns></returns>
        public SZSLSystem.Model.WebSet loadConfig(string configFilePath)
        {
            return (SZSLSystem.Model.WebSet)SerializationHelper.Load(typeof(SZSLSystem.Model.WebSet), configFilePath);
        }

        /// <summary>
        /// 保存配置文件
        /// </summary>
        /// <param name="mode"></param>
        /// <param name="configFilePath"></param>
        /// <returns></returns>
        public SZSLSystem.Model.WebSet saveConifg(SZSLSystem.Model.WebSet model, string configFilePath)
        {
            lock (lockHelper)
            {
                SerializationHelper.Save(model, configFilePath);
            }
            return model;
        }
    }
}
